﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.BankAccounts
{
    public class BankAccountUserIdSpecification: Specification<BankAccount>
    {
        Guid _MembershipUserId;

        public BankAccountUserIdSpecification(Guid userId)
        {
            this._MembershipUserId = userId;
        }

        public override System.Linq.Expressions.Expression<Func<BankAccount, bool>> SatisfiedBy()
        {
            Specification<BankAccount> spec = new TrueSpecification<BankAccount>();

            spec &= new DirectSpecification<BankAccount>(t => t.IsEnabled);

            spec &= new DirectSpecification<BankAccount>(c => c.UserId == this._MembershipUserId);

            return spec.SatisfiedBy();
        }

    }
}
